// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Header from '@/components/nav/Header'
import Sidebar from '@/components/nav/Sidebar'
import Treelist from '@/components/content/tree/Treelist'
import Treelist_read from '@/components/content/tree/Treelist_read'
import axios from 'axios'


Vue.config.productionTip = false;
Vue.component('Header',Header);
Vue.component('Sidebar',Sidebar);
Vue.component('treelist',Treelist);
Vue.component('treelist_read',Treelist_read);

Vue.prototype.$api = 'http://localhost:8000/api';

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

// 请求拦截器 获取响应数据后执行
axios.interceptors.response.use(function (res) {
    if(res.data.code==10014 || res.data.code==4101){
      window.location.href = '/login';
    }
    return res
  }, function (error) {
  　　// 对响应错误做点什么
  　　return Promise.reject(error);
  });